﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Website.LopHocService;

namespace Website.SinhVien
{
    public partial class KetQuaDangKyHocPhan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.LoadView();
            
        }

        private void LoadView()
        {
            LopHocService.LopHocSoapClient client = new LopHocSoapClient();
            YeuCauLopHocDaDangKy yeucau = new YeuCauLopHocDaDangKy();
            yeucau.HocKy = Convert.ToInt32(Session["HocKy"]);
            yeucau.Nam = Convert.ToInt32(Session["Nam"]);
            yeucau.MaSoSinhVien = "0812475";

            this.dtgKetQuaDangKyHocPhan.DataSource = client.layDanhSachLopHocDaDangKy(yeucau).DanhSachLopHocDaDangKy;
            this.dtgKetQuaDangKyHocPhan.DataBind();
        }

        protected void lbtnHuyDangKy_Click(object sender, EventArgs e)
        {
            LinkButton lbtn = (LinkButton)sender;

            int LopID = Convert.ToInt32(lbtn.CommandArgument);
            LopHocService.LopHocSoapClient client = new LopHocSoapClient();

            YeuCauXoaSinhVienKhoiLop yeucau = new YeuCauXoaSinhVienKhoiLop();
            yeucau.MaLop = LopID;
            yeucau.MaSoSinhVien = "0812475";

            client.xoaSinhVienKhoiLop(yeucau);

            this.LoadView();
        }
    }
}
